package ME.VPC.S.buttons;

import ME.VPC.M.app.App;
import ME.VPC.S.ne.Page_X_S_sVSQ;
import ME.VPC.S.pillow.PageWords;
import M_V.MVQ.button.DetaButton;
import S_A.SVQ.stable.S_Maps;
import S_A.pheromone.IMV_SQI_SS;
import S_A.pheromone.IMV_SQI_S_;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
//import OCI.ME.analysis.C.A;
//import OSV.VCQ.standard.DictionaryStandardDB;

/*
 * 个人著作权人, 作者 罗瑶光, 浏阳
 * yaoguangluo@outlook.com, 313699483@qq.com, 2080315360@qq.com,
 * （lyg.tin@gmail.com2018年后因G网屏蔽不再使用）
 ** 15116110525-浏阳德塔软件开发有限公司-创始人-法人-总经理-永久非盈利-
 * 430181198505250014, G24402609, EB0581342
 * 204925063, 389418686, F2406501, 0626136
 * 湖南省 浏阳市 集里街道 神仙坳社区 大塘冲路一段
*  208号 阳光家园别墅小区 第十栋别墅 第三层
 * */
//shaohou tongyi gai
public class Page_X_S_sButtonsrollafter {
	public static DetaButton data_X_rollafter(Page_X_S_sVSQ page_X_S_s,
			int maxInPage, App NE) {
		DetaButton buttonNext = new DetaButton("->");
		// buttonNext.setBounds(410, 0, 100, 30);
		buttonNext.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				IMV_SQI_SS map = new IMV_SQI_SS();
				try {
					page_X_S_s.currentPage += 1;
					if (page_X_S_s.currentPage * maxInPage >= page_X_S_s.sets
							.size()) {
						page_X_S_s.currentPage -= 1;
						return;
					}
					page_X_S_s.currentPage = (page_X_S_s.currentPage > (page_X_S_s.sets == null
							? 0
							: page_X_S_s.sets.size()) / maxInPage + 1
									? page_X_S_s.currentPage - 1
									: page_X_S_s.currentPage);
					StringBuilder page = new StringBuilder().append("");
					List<String> setsForGet = page_X_S_s.sets.subList(
							page_X_S_s.currentPage * maxInPage,
							(page_X_S_s.currentPage + 1)
									* maxInPage < page_X_S_s.sets.size()
											? (page_X_S_s.currentPage + 1)
													* maxInPage
											: page_X_S_s.sets.size());
					PageWords.renderWordLoopPOS(page, setsForGet, map,
							page_X_S_s.key, true, NE);
					page_X_S_s.buttonCrt
							.setText("当前页面：" + (page_X_S_s.currentPage + 1));
					page_X_S_s.data.setText(page.toString());
					page_X_S_s.data.setSelectionStart(0);
					page_X_S_s.data.setSelectionEnd(0);
					page_X_S_s.data.validate();
				} catch (Exception e1) {
					page_X_S_s.data.validate();
					page_X_S_s.jTabbedpane.validate();
				}
				try {
					page_X_S_s.statistic.setSize(500, 800);
					IMV_SQI_S_ fwa = page_X_S_s._A
							.sortWordFrequencyMapToSortMap(map);
					page_X_S_s.statistic.setContentType("text/html");
					StringBuilder page = new StringBuilder();
					Here: for (int i = fwa.size() - 1; i >= 0; i--) {
						if (fwa.get(i) != null) {
							if (page_X_S_s.pos
									.get(fwa.getW(i).get_word()) == null) {
								page.append("<div style=\"background:white\">"
										+ "<font color=\"black\">"
										+ fwa.getW(i).get_word() + ""
										+ fwa.getW(i).get_frequency()
										+ "</font></div>");
								continue Here;
							}
							if (S_Maps.mingCi
									.containsKey(fwa.getW(i).get_word())) {
								page.append("<div style=\"background:#FF44FF\">"
										+ "<font color=\"white\">"
										+ fwa.getW(i).get_word() + ""
										+ fwa.getW(i).get_frequency()
										+ "</font></div>");
								continue Here;
							}
							if (S_Maps.dongCi
									.containsKey(fwa.getW(i).get_word())) {
								page.append("<div style=\"background:#8CEA00\">"
										+ "<font color=\"black\"" + " size=\""
										+ NE.app_S.size_font_rot + "\">"
										+ fwa.getW(i).get_word() + ""
										+ fwa.getW(i).get_frequency()
										+ "</font></div>");
								continue Here;
							}
							if (S_Maps.xingRongCi
									.containsKey(fwa.getW(i).get_word())) {
								page.append("<div style=\"background:#FF9224\">"
										+ "<font color=\"black\"" + " size=\""
										+ NE.app_S.size_font_rot + "\">"
										+ fwa.getW(i).get_word() + ""
										+ fwa.getW(i).get_frequency()
										+ "</font></div>");
							}
						}
					}
					page_X_S_s.statistic.setText(page.toString());
					page_X_S_s.statistic.setSelectionStart(0);
					page_X_S_s.statistic.setSelectionEnd(0);
					page_X_S_s.statistic.validate();
				} catch (Exception e1) {
					page_X_S_s.statistic.validate();
					page_X_S_s.jTabbedpane.validate();
				}
			}
		});
		return buttonNext;
	}
}